@page
@{ Layout = "_LayoutHome"; }
@section Styles{
    <style>
        .el-form-item {
            margin-bottom: 0px;
        }
        body,html{
            padding: 0;
            margin: 0;
        }
    </style>
}
<div class="rounded-0 shadow p-3 bg-white sticky-top">
    <div class="fw-bolder text-center">
        学习任务
    </div>
</div>
<div class="px-5 py-4">
    <el-form v-on:submit.native.prevent :inline="true" :model="form">
        <el-form-item label="">
            <el-input clearable prefix-icon="el-icon-search" v-model="form.keyWords" placeholder="关键字" class="w-100"></el-input>
        </el-form-item>
        <el-form-item label="年度">
            <el-select v-model="form.year" clearable placeholder="全部年度" class="w-100">
                <el-option label="全部年度"
                           :value="0">
                </el-option>
                <el-option :label="planYear+'年'" v-for="planYear in yearList"
                           :value="planYear">
                </el-option>
            </el-select>
        </el-form-item>
        <el-form-item label="状态">
            <el-select v-model="form.state" clearable placeholder="学习状态" class="w-100">
                <el-option label="全部状态"
                           value="">
                </el-option>
                <el-option label="已完成"
                           value="Yiwancheng">
                </el-option>
                <el-option label="已达标"
                           value="Yidabiao">
                </el-option>
                <el-option label="学习中"
                           value="Xuexizhong">
                </el-option>
                <el-option label="未完成"
                           value="Weiwancheng">
                </el-option>
                <el-option label="未开始"
                           value="Weikaishi">
                </el-option>
            </el-select>
        </el-form-item>
        <el-form-item>
            <el-button icon="el-icon-search" v-on:click="btnSearchClick">查询</el-button>
        </el-form-item>
    </el-form>
</div>
<div v-if="total>0">
    <div class="row mx-5">
        <div class="col-xl-12 col-lg-12 col-md-12 col-12 mb-4" v-for="(studyPlan,planIndex) in list">
            <div class="card card-hover position-relative card-lift rounded-3" style="cursor:pointer;" v-on:click="studyPlan.isStudy ? btnViewClick(studyPlan.id) : utils.error('计划不在有效期内')">
                <div class="position-absolute top-50 end-0 translate-middle-y pe-5">
                    <img width="99" src="/sitefiles/assets/images/status/weikaishi.png" v-if="studyPlan.state==='Weikaishi'" />
                    <img width="99" src="/sitefiles/assets/images/status/xuexizhong.png" v-if="studyPlan.state==='Xuexizhong'" />
                    <img width="99" src="/sitefiles/assets/images/status/yidabiao.png" v-if="studyPlan.state==='Yidabiao'" />
                    <img width="99" src="/sitefiles/assets/images/status/weidabiao.png" v-if="studyPlan.state==='Weidabiao'" />
                    <img width="99" src="/sitefiles/assets/images/status/yiwancheng.png" v-if="studyPlan.state==='Yiwancheng'" />
                </div>
                <div class="row">
                    <div class="col-4 col-md-4 col-xl-4 col-lg-4 bg-cover rounded-start-3" :style="{'background-image':'url('+studyPlan.plan.coverImg+')'}">
                    </div>
                    <div class="col-8 col-md-8 col-xl-8 col-lg-8">
                        <div class="card-body">
                            <h3 class="mb-4">{{ studyPlan.plan.planName }}</h3>
                            <ul class="mb-2 list-inline">
                                <li class="list-inline-item">
                                    <span class="fw-light fs-5">计划年度：</span><span class="fw-bold text-warning">{{ studyPlan.plan.planYear }}</span>
                                </li>
                                <li class="list-inline-item">
                                    <span class="fw-light fs-5">计划学分：</span><span class="fw-bold text-success">{{ studyPlan.totalCredit }}</span>/<span class="fw-light fs-5">{{ studyPlan.plan.planCredit }}</span>
                                </li>
                            </ul>
                            <ul class="mb-5 list-inline">
                                <li class="list-inline-item">
                                    <span class="fw-light fs-5">必修课：</span><span class="fw-bold text-success">{{ studyPlan.overCourseTotal }}</span>/<span class="fw-light fs-5">{{ studyPlan.plan.totalCount }}</span>
                                </li>
                                <li class="list-inline-item">
                                    <span class="fw-light fs-5">选修课：</span><span class="fw-bold text-success">{{ studyPlan.overSelectCourseTotal }}</span>/<span class="fw-light fs-5">{{ studyPlan.plan.selectTotalCount }}</span>
                                </li>
                            </ul>
                            <div class="row align-items-center g-0">
                                <div class="col-auto">
                                    <i class="bi bi-calendar-range text-warning"></i>
                                </div>
                                <div class="col ms-2">
                                    <span>{{ studyPlan.plan.planBeginDateTimeStr }} -  {{ studyPlan.plan.planEndDateTimeStr }}</span>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="my-5 text-center">
        <el-button class="border-0 rounded-pill" icon="el-icon-refresh-right" v-if="list.length>0 && list.length<total" v-on:click="btnLoadMoreClick" :loading="loadMoreLoading">加载更多</el-button>
        <small v-else>没有更多了</small>
    </div>
</div>
<div class="pt-10" v-else>
    <el-empty></el-empty>
</div>
@section Scripts{
    <script src="/sitefiles/assets/js/home/study/studyPlan.js" type="text/javascript"></script>
}